    function initZtree(treeData){
        var setting = {
            data:{
                simpleData:{
                    enable:true,
                    idKey: "smId",
                    pIdKey: "parentId"
                },
                key: {
                    name: "menuName"
                }
            },
            callback: {
//                onClick: zTreeOnClick
            }
        };
        zTreeObj= $.fn.zTree.init($("#ztreelist"), setting, treeData);
    }
$(document).ready( function () {
    $.post("/sysMenu/tree",{},function(result){
        if(result){
            initZtree(result['data']);
        }else{
            alert("系统错误");
        }
    });
    //构建树新结构菜单
    var table =  $('#data_table').DataTable({
        pageLength:10,
        info : true, //显示表格左下角信息
        ordering: false,//关闭表格默认排序
        paging: true, //分页
        processing:true, //设置为true,就会有表格加载时的提示
        searching: false, //关闭本地搜索
        serverSide: true,//如果是服务器方式，必须要设置为true
        //使用ajax异步请求
        ajax:{
            dataSrc: function (json) {
                json.draw = json.data.draw;
                json.recordsTotal = json.data.recordsTotal;
                json.recordsFiltered = json.data.recordsFiltered;
                return json.data.data;
            },
            url:'/sysUser/list',
            type:'post'
        },
        columns: [
            { data: null,title: "<input type='checkbox' name='checklist' id='checkall' class='checkall'/>",
                render: function(data, type, row, meta) {return '<input id="checkchild" type="checkbox"  class="checkchild" value="' + row.suidCode + '" />'}
            },
            {data:"index",title:"序号",
                render:function(data,type,row,meta){var startIndex = meta.settings._iDisplayStart;return startIndex+meta.row+1}
            },
            { data: 'suidCode' ,title:"id"},
            { data: 'userName' ,title:"用户名"},
            { data: 'roldName' ,title:"角色"},
            { data: 'jobNumber' ,title:"工号"},
            { data: 'mobile' ,title:"手机号"},
            { data: 'createUserName' ,title:"创建人"},
            { data: 'createTime' ,title:"创建时间"},
            { data: 'state' ,title:"状态",
                render:function (data,type,row,meta) {
                return lyyApplication.initStatus(data,"start-using");
                }}
        ]
    });
} );
//添加用户
function add() {
    layer_show("添加用户","/sysUser/add-page");
}
//删除用户
function del(){
    //判断选择的条数是不是只有一条
    var arrays = checkedValue("checkchild");
    if (lyyApplication.util.isEmpty(arrays)){
        layer.alert("请选择要删除的记录");
        return false;
    }
    if (arrays.length>1){
        layer.alert("只能选择一条记录删除");
        return false;
    }
    layer.confirm("确认删除用户？", function(){
        $.post("/sysUser/del",{suidCode:arrays[0]},function (result) {
            if (result){
                if (result['status']===0){
                    layer.confirm(result['msg'], function(){
                        window.location.reload();
                    });

                }else {
                    layer.alert(result['msg']);
                }
            }else {
                layer.alert('系统异常');
            }
        })
    });

}
//修改用户
function update() {
    //判断选择的条数是不是只有一条
    var arrays = checkedValue("checkchild");
    if (isEmpty(arrays)){
        layer.alert("请选择要修改的记录");
        return false;
    }
    if (arrays.length>1){
        layer.alert("只能选择一条记录修改");
        return false;
    }
    layer_show("修改用户","/sysUser/update-page?suidCode="+arrays[0]);
}
